package com.example.myapplication.slice;

import com.example.myapplication.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;

public class HistoryMonitorDataSlice extends AbilitySlice {

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_history_monitor_data3);

        Button yesterdayDataButton = findComponentById(ResourceTable.Id_yesterday_data_button3);
        Button todayDataButton = findComponentById(ResourceTable.Id_today_data_button3);
        Button historyBackIndexButton = findComponentById(ResourceTable.Id_history_back_index_button3);
        Component.ClickedListener listener = new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                if (component == yesterdayDataButton) {
                    present(new YesterdayMonitorDataSlice(), new Intent());
                } else if (component == todayDataButton) {
                    present(new TodayMonitorDataSlice(), new Intent());
                }else if (component == historyBackIndexButton){

                }
            }
        };
        yesterdayDataButton.setClickedListener(listener);
        todayDataButton.setClickedListener(listener);
        historyBackIndexButton.setClickedListener(listener);

    }
}
